// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import { roomItem } from "../../../../script/game/gameType";
import { ListItem } from "../../../../script/util/ListView/ListItem";
import { ccs } from "../../../../script/util/services";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends ListItem<roomItem> {
   
    @property(cc.Label)
    title: cc.Label = null;

    @property(cc.Label)
    desc: cc.Label = null;

    start () {

    }
    initItem(data: roomItem, index: number) {
        this.title.string = data.name;
        this.desc.string = data.desc || "神秘的地方";
    }
    onItemclick(data: roomItem) {
        if(data.type) {
            ccs.winMgr.showWin("popItemsWin", {id: data.type}) //使用或丢弃
        } else {
            ccs.winMgr.showWin("popEventWin", {id: data.id}) //行为动作
        }
    }

}
